package com.aw.baselib.util.download

import com.aw.baselib.base.AwBaseApplication
import java.io.File
import java.io.Serializable

class DownloadResBean : Serializable {
    var url: String? = null
    var totalSize: String? = null
    var currentSize: String? = null
    var isCompleted = false
    var path: String? = null
        get() {
            val file =
                File(AwBaseApplication.instance?.externalCacheDir.toString() + File.separator + "downloadRes")
            if (!file.exists()) file.mkdirs()
            var downloadResFile: File? = null
            downloadResFile = try {
                File(file, fileName)
            } catch (e: Exception) {
                e.printStackTrace()
                file
            }
            field = downloadResFile!!.absolutePath
            return field
        }
        private set
    var fileName: String? = null
}